 //
//  ViewController.m
//  FKBannerViewDemo
//
//  Created by 云眼科技 on 16/7/22.
//  Copyright © 2016年 CloudEyes. All rights reserved.
//

#import "ViewController.h"
#import "FKBannerView/FKBannerView.h"

#ifndef W_H_
#define kWidth [UIScreen mainScreen].bounds.size.width
#define kHeight [UIScreen mainScreen].bounds.size.height
#endif

@interface ViewController ()<FKBannerViewDatasource, FKBannerViewDelegate>{
    NSArray <NSString *> *imageArr;
}

@property (nonatomic, strong) FKBannerView *bannerView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.bannerView];
    imageArr = @[@"1.png", @"2.jpg", @"3.jpg"];
}


-(UIView *)bannerView:(FKBannerView *)bannerView viewForItemAtIndex:(NSInteger)index{
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:bannerView.bounds];
    imageView.image = [UIImage imageNamed:imageArr[index]];
    return imageView;
}

-(NSInteger)numberOfItemsInBannerView:(FKBannerView *)bannerView{
    return 3;
}

-(void)bannerView:(FKBannerView *)bannerView didSelectedItemAtIndex:(NSInteger)index{
    NSLog(@"%ld", index);
}

-(FKBannerView *)bannerView{
    if (!_bannerView) {
        _bannerView = [[FKBannerView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 200)];
        _bannerView.delegate = self;
        _bannerView.datasource = self;
    }
    return _bannerView;
}



@end
